package com.lagou.sqlsession;

import com.lagou.pojo.Configuration;
import com.lagou.pojo.MappedStatement;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;

/**
 * 执行器
 */
public interface Executor {

    /**
     * 查询API
     * @param configuration
     * @param mappedStatement
     * @param params
     * @param <E>
     * @return
     */
    public  <E> List<E> query( MappedStatement mappedStatement,Object... params) throws SQLException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException, IntrospectionException, InstantiationException, InvocationTargetException;


    /**
     * 写入操作
     * @param statementid
     * @param params
     * @return
     */
    public int update( MappedStatement mappedStatement,Object... params) throws SQLException, IllegalAccessException, NoSuchFieldException, ClassNotFoundException;



    void commit() throws SQLException;

    void rollback() throws SQLException;
}
